package com.cskaoyan.service;


import com.cskaoyan.bean.domain.GoodsExample;
import com.cskaoyan.bean.domain.GoodsProductExample;
import com.cskaoyan.bean.domain.OrderExample;
import com.cskaoyan.bean.domain.UserExample;
import com.cskaoyan.mapper.GoodsMapper;
import com.cskaoyan.mapper.GoodsProductMapper;
import com.cskaoyan.mapper.OrderMapper;
import com.cskaoyan.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author lirui
 * @Date 2021/11/30 11:32
 * @describe:
 */
@Service
public class DashBoardServiceImpl implements DashBoardService {
    @Autowired
    GoodsMapper goodsMapper;
    @Autowired
    UserMapper userMapper;
    @Autowired
    GoodsProductMapper goodsProductMapper;

    @Autowired
    OrderMapper orderMapper;

    @Override
    public Integer querygoodsnum() {

        GoodsExample goodsExample=new GoodsExample();

        Integer goodsnum = (int)goodsMapper.countByExample(goodsExample);

        return goodsnum;
    }

    @Override
    public Integer queryusernum() {
        UserExample userExample = new UserExample();

        Integer usernum = (int)userMapper.countByExample(userExample);
        return usernum;
    }

    @Override
    public Integer queryproductnum() {
        GoodsProductExample goodsProductExample = new GoodsProductExample();
        Integer productnum = (int)goodsProductMapper.countByExample(goodsProductExample);
        return productnum;
    }

    @Override
    public Integer queryordertotal() {
        OrderExample orderExample = new OrderExample();
        Integer ordernum = (int)orderMapper.countByExample(orderExample);
        return ordernum;
    }
}
